#include "cuda_helper.h"

void cudadelete(void *devptr)
{
	cutilSafeCall(cudaFree(devptr));
}

void cudamalloc(void *devptr, size_t size)
{
	cutilSafeCall(cudaMalloc((void**) devptr, size));
}

void cudamemcpydevice(void *destination, void *source, size_t size)
{
	cutilSafeCall(cudaMemcpy(destination, source, size, cudaMemcpyHostToDevice));
}

void cudamemcpyhost(void *destination, void *source, size_t size)
{
	cutilSafeCall(cudaMemcpy(destination, source, size, cudaMemcpyDeviceToHost));
}

unsigned int* cudacreatestarttimer()
{
	unsigned int* timer = new unsigned int;
	*timer = 0;
	CUT_SAFE_CALL( cutCreateTimer( timer));
	CUT_SAFE_CALL( cutStartTimer( *timer));	
	return timer;
}

void cudastopdeletetimer(unsigned int* timer)
{
	CUT_SAFE_CALL( cutStopTimer( *timer));
	CUT_SAFE_CALL( cutDeleteTimer( *timer));
	delete timer;
}

void cudaresettimer(unsigned int* timer)
{
	CUT_SAFE_CALL(cutResetTimer(*timer));
}

void cudacheckerror()
{
	CUT_CHECK_ERROR("Error\n");

}